package com.boot.plus.web.user;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.boot.plus.entity.User;
import com.boot.plus.service.UserService;

@RestController
@RequestMapping(value="/user")
public class UserOperationController {
	
	//注入service
	@Autowired
	private UserService userService;
	
	@RequestMapping(value="getAllUser")
	public Map<String, Object> getAllUser(){
		Map<String, Object> modelMap = new HashMap<>();
		List<User> list = userService.getAllUser();
		if(list.size() < 0) {
			modelMap.put("success", false);
			modelMap.put("msg", "error");
		}else {
			modelMap.put("success", true);
			modelMap.put("userList", list);
		}
		
		return modelMap;
	}
}
